/**
 * @file t_at_ringbuffer.h
 * @brief This is the header file for t_at_ringbuffer.c, which is the ring buffer for the AT command module.
 * @version 1.0
*/
#ifndef T_AT_RINGBUFFER_H
#define T_AT_RINGBUFFER_H
#include "t_at_port.h"
#ifdef __cplusplus
extern "C" {
#endif

typedef enum{
    RBUF_ERROR=-1,
    RBUF_OK=1,
    RBUF_EMPTY,
    RBUF_FULL,
    RBUF_NO_MEM,
}rbuf_err_t;

typedef struct{
  uint8_t buffer[URC_DATA_BUFFER_SIZE];
  uint16_t buf_len;
	void * arg;
}rdata_buff;

typedef struct {
    rdata_buff ringbuffer[URC_RING_SIZE];
    uint16_t head;
    uint16_t tail;
    uint16_t size;
}rbuf;

rbuf_err_t rbuf_init(rbuf *rbuf_t);
rbuf_err_t rbuf_push(rbuf *rbuf_t,rdata_buff *rdata_buff_t);
rbuf_err_t rbuf_pop(rbuf *rbuf_t ,rdata_buff *rdata_buff_t);
rbuf_err_t rbuf_clear(rbuf *rbuf_t);
rbuf_err_t rbuf_is_empty(rbuf *rbuf_t);
rbuf_err_t rbuf_is_full(rbuf *rbuf_t);


#ifdef __cplusplus
}
#endif

#endif // T_AT_RINGBUFFER_H

